What is returned?
by Savonnah '23
def num_name(word, x):
result = 0
for i in word:
if i == x:
result += 1
return result
Function Call | Return Value | |||
---|---|---|---|---|
num_name('cheese', 'e') | → | |||
num_name('cat', 'z') | → | |||
num_name('pink jeans', ' ') | → | |||
num_name('waterbottle', 't') | → |
Experiment with this code on Gitpod.io